#pragma once

#define REAL double

void boundary_force(REAL **bdpo, REAL **bd_force, int nt, REAL *ds);
void fluid_force(REAL **fxx, REAL **fyy, REAL **bd_posi, REAL **bd_force, int nt);

void move_boundary(REAL **bdpo, int nt, REAL **u, REAL **v);
REAL delta(REAL x);

void calc_bdry_normal(REAL **bd_posi, REAL **bd_unit_normal, REAL *ds, int nt);
void calc_bdry_normal_curvature(REAL **bd_posi, REAL **bd_unit_normal, REAL *bd_curvature, REAL *ds, int nt);
void calc_bdry_normal_curvature2(REAL **bd_posi, REAL **bd_unit_normal, REAL *bd_curvature, REAL *ds, int nt);  // without qudratic polynomial approximation 
REAL calc_area(REAL **bdpo, int nt);
void repair_bd(REAL **bdpo, REAL **bd_unit_normal, REAL ini_area, REAL area, int nt);  // old one
void repair_bd_curvature(REAL **bdpo, REAL **bd_unit_normal, REAL *bd_curvature, REAL ini_area, REAL area, int nt);
void make_ds(REAL *ds, REAL **p, int npo);

void check_boundary(REAL ***ref_bdpo, REAL **ref_ds, REAL ds_max, REAL ds_min, int *ref_nt);
//REAL quadratic(REAL x, REAL c[]);
//void quadratic_approximation(REAL c[], REAL p0, REAL p1, REAL p2, REAL ds1, REAL ds2);
void make_center(REAL **bdpo, int n_po, REAL center[]);

REAL calc_bdry_length(REAL **p, int nt);

void area_correct(REAL **bdpo, REAL **bd_unit_normal, REAL *ds, int nt, REAL ini_area, REAL area);  // old one 
void area_correct_normal_curvature(REAL **bdpo, REAL **bd_unit_normal, REAL *bd_curvature, REAL *ds, int nt, REAL ini_area, REAL area);
void augment_bdpo(REAL **bdpo, int nt);

